// JavaScript Document
function validate(){
	
	var regno = document.getElementById('txtRegno');
	var subgr = document.getElementById('sltSubgr');
	var att_dt = document.getElementById('txtdt');
	
	if(notEmpty(regno, "Registration Number cannot be empty")){
	   if(isNumeric(regno, "Registration Number should be numeric ")){
	        if(madeSelection(subgr, "Select the subject code")){
	            if(notEmpty(att_dt, "Please enter Attend date")){
	                     
	                                     loadXMLDoc()
	
	
				}
	     return false;
			}
	     return false;
		 } 
	    return false; 
		}
	return false; 
	}
	
	
	
	function loadXMLDoc()
{


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		
    document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText;
	document.getElementById("myForm").reset(); 
	
    }
  }

                var regno = document.getElementById('txtRegno').value;	
                var att_dt = document.getElementById('txtdt').value;	
                var subgr = document.getElementById('sltSubgr').value;
	
	
	
	var queryString ="?regno=" + regno +"&att_dt="+att_dt + "&subgr=" + subgr ;
	
	
xmlhttp.open("GET","../logic/add/att_student_add.php"+queryString ,true);
xmlhttp.send();
}
	
	
	
	function checkregno(){

var regno = document.getElementById('txtRegno');

if(notEmpty(regno, "Registration Number cannot be empty")){

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
    }
  else
   {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
    xmlhttp.onreadystatechange=function()
     {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
									//document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText; 
									 
   var x=xmlhttp.responseText;
if(x=="false"){
									
  document.getElementById("ajaxDiv1").innerHTML="Invalid Registration No";
  document.getElementById('txtRegno').value="";
	}else{
  document.getElementById("ajaxDiv1").innerHTML=x; 
									
			}
			}
            }
								
  var y=document.getElementById('txtRegno').value;
  var queryString ="?regno=" + y;
  xmlhttp.open("GET","../logic/load/check_reg.php"+queryString,true);
  xmlhttp.send();	  
	}
	
}
	
	
	function clearx()
{
	
	 document.getElementById("myForm").reset(); 
     document.getElementById("ajaxDiv").innerHTML="";
	 document.getElementById("ajaxDiv1").innerHTML="";
}